﻿using System.IO;

namespace IndirectX.Shaders
{
    public class ResourceDefinitionChunk : Chunk
    {
        public override void Parse(DataStream stream)
        {
            BinaryReader reader = new BinaryReader(stream);
            var constantBufferCount = reader.ReadUInt32();
            var constantBufferOffset = reader.ReadUInt32();
            var resourceBindingCount = reader.ReadUInt32();
            var resourceBindingsOffset = reader.ReadUInt32();
            var requiredShaderVersion = reader.ReadUInt32();
            var flags = reader.ReadUInt32();
            //TODO

            reader.BaseStream.Seek(resourceBindingsOffset, SeekOrigin.Begin);
            for (int j = 0; j < resourceBindingCount; j++)
            {
                var nameOffset = reader.ReadUInt32();
                reader.BaseStream.Seek(nameOffset, SeekOrigin.Begin);
                var name = reader.ReadString();
            }
        }
    }
}